package com.dyna.config;

import org.dromara.sms4j.aliyun.config.AlibabaConfig;
import org.dromara.sms4j.core.config.SupplierFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AliConfiguration{

    private static final String ACCESS_KEY = "LTAI5tNHrKEUqNQYYVikCPhe";
    private static final String ACCESS_KEY_SECRET = "XDZ8l7Jt9aFDCPuFO2LJnfXYEjLeUq";

    private static final String SIGNATURE = "dynamic611";
    private static final String TEMPLATE_ID = "SMS_461510053"; // 固定消息模板

//    private static final String SIGNATURE = "周才旺的博客"; // 需要申请正式签名
//    private static final String TEMPLATE_ID = "SMS_280555013"; // 使用占位符code控制消息模板
    private static final String TEMPLATE_NAME = "code";

    @Bean
    public void setConfiguration(){
        AlibabaConfig alibabaConfig = SupplierFactory.getAlibabaConfig();
        // 登录aliyun平台的key和secret
        alibabaConfig.setAccessKeyId(ACCESS_KEY);
        alibabaConfig.setAccessKeySecret(ACCESS_KEY_SECRET);
        // 签名
        alibabaConfig.setSignature(SIGNATURE);
        // 模板id
        alibabaConfig.setTemplateId(TEMPLATE_ID);
        alibabaConfig.setTemplateName(TEMPLATE_NAME);
    }
}